package track;

import io.SqlDb;

public class playlistEntry {
	private Artist artist;
	private Track song;
	private Disc album;
	private Genre g;
	public Genre getG() {
		return g;
	}

	public void setG(Genre g) {
		this.g = g;
	}

	public playlistEntry(Artist artist, Track song, Disc album, Genre g){
		this.artist = artist;
		this.song = song;
		this.album = album;
		this.g = g;
	}
	
	public Artist getArtist() {
		return artist;
	}

	public void setArtist(Artist artist) {
		this.artist = artist;
	}

	public Track getSong() {
		return song;
	}

	public void setSong(Track song) {
		this.song = song;
	}

	public Disc getAlbum() {
		return album;
	}

	public void setAlbum(Disc album) {
		this.album = album;
	}

	public void updatePE(Artist artist, Track song, Disc album) {
		SqlDb.executeUpdate("UPDATE tracks " +
				"SET name='" + song.getName() + "' " +
				"WHERE id=" + song.getId());

		SqlDb.executeUpdate("UPDATE artists " +
				"SET name='" + artist.getName() + "' " +
				"WHERE id=" + artist.getId());

		setArtist(artist);
		setSong(song);
	}
	public String sDescription(){
		return getArtist().getName() + " - " + getSong().getName();
	}

	public String toString() {
		return "playlistEntry [album=" + album + ", artist=" + artist
				+ ", song=" + song + "]";
	}	
}
